{$CLEO .cs}
{$USE CLEO+}
{$USE newOpcodes}
{$USE ini}

0000: NOP

script_name "FasAnims"

// By ArtemQa146 (Edited by ArmanCan)

if
    8AAB: not does_file_exist "cleo\FasterAnimations.ini"
then
    0AD1: show_formatted_text_highpriority "The FasterAnimations.ini file was not detected!" time 10000
    terminate_this_custom_script
end

const
    Food = 1
    Ammu = 2
    Clothes = 3
    Clothes_skip = 4
    Wardrobe = 5
    Gymbench = 6
    Gymdumb = 7
    Gymtread = 8    
    Donut = 9    
    barber = 10
end

read_float_from_ini_file 2@ = read_float_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "FoodAnimationSpeed"
read_float_from_ini_file 3@ = read_float_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "AmmuAnimationSpeed"
read_float_from_ini_file 4@ = read_float_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "ClothesShopAnimationSpeed"
read_float_from_ini_file 5@ = read_float_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "WardrobeAnimationSpeed"
read_float_from_ini_file 6@ = read_float_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "GymBenchAnimationSpeed"
read_float_from_ini_file 7@ = read_float_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "GymDumpAnimationSpeed"
read_float_from_ini_file 8@ = read_float_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "GymTreadAnimationSpeed"
read_float_from_ini_file 9@ = read_float_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "DonutAnimationSpeed"
read_float_from_ini_file 10@ = read_float_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "BarberAnimationSpeed"

clear_local_var_bit_const 31@ bit Food
read_int_from_ini_file 0@ = read_int_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "FoodAnimation"
if 0@ == 1
then set_local_var_bit_const 31@ bit Food
end

clear_local_var_bit_const 31@ bit Ammu
read_int_from_ini_file 0@ = read_int_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "AmmuAnimation"
if 0@ == 1
then set_local_var_bit_const 31@ bit Ammu
end

clear_local_var_bit_const 31@ bit Clothes
read_int_from_ini_file 0@ = read_int_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "ClothesShopAnimation"
if 0@ == 1
then set_local_var_bit_const 31@ bit Clothes
end

clear_local_var_bit_const 31@ bit Clothes_skip
read_int_from_ini_file 0@ = read_int_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "ClothesShopSkipWaiting"
if 0@ == 1
then set_local_var_bit_const 31@ bit Clothes_skip
end

clear_local_var_bit_const 31@ bit Wardrobe
read_int_from_ini_file 0@ = read_int_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "WardrobeAnimation"
if 0@ == 1
then set_local_var_bit_const 31@ bit Wardrobe
end

clear_local_var_bit_const 31@ bit Gymbench
read_int_from_ini_file 0@ = read_int_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "GymBenchAnimation"
if 0@ == 1
then set_local_var_bit_const 31@ bit Gymbench
end

clear_local_var_bit_const 31@ bit Gymdumb
read_int_from_ini_file 0@ = read_int_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "GymDumpAnimation"
if 0@ == 1
then set_local_var_bit_const 31@ bit Gymdumb
end

clear_local_var_bit_const 31@ bit Gymtread
read_int_from_ini_file 0@ = read_int_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "GymTreadAnimation"
if 0@ == 1
then set_local_var_bit_const 31@ bit Gymtread
end

clear_local_var_bit_const 31@ bit Donut
read_int_from_ini_file 0@ = read_int_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "DonutAnimation"
if 0@ == 1
then set_local_var_bit_const 31@ bit Donut
end

clear_local_var_bit_const 31@ bit barber
read_int_from_ini_file 0@ = read_int_from_ini_file "cleo\FasterAnimations.ini" section "Settings" key "BarberAnimation"
if 0@ == 1
then set_local_var_bit_const 31@ bit barber
end

while true
wait 0
    if
        Player.Defined($PLAYER_CHAR)
    then
    
        get_script_struct_named 1@ = get_script_struct_named 'GYMBENC' //     
        if and
            is_local_var_bit_set_const 31@ bit Gymbench
            1@ > 0
        then
            //  
            if Actor.Animation($PLAYER_ACTOR) == "GYM_BP_CELEBRATE"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "GYM_BP_CELEBRATE" at 6@
            end
            if Actor.Animation($PLAYER_ACTOR) == "GYM_BP_GETOFF"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "GYM_BP_GETOFF" at 6@
            end
            if Actor.Animation($PLAYER_ACTOR) == "GYM_BP_GETON"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "GYM_BP_GETON" at 6@
            end
        end

        get_script_struct_named 1@ = get_script_struct_named 'GYMDUMB' //     
        if and
            is_local_var_bit_set_const 31@ bit Gymdumb
            1@ > 0
        then
            //  
            if Actor.Animation($PLAYER_ACTOR) == "GYM_FREE_CELEBRATE"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "GYM_FREE_CELEBRATE" at 7@
            end
            if Actor.Animation($PLAYER_ACTOR) == "GYM_FREE_PICKUP"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "GYM_FREE_PICKUP" at 7@
            end
            if Actor.Animation($PLAYER_ACTOR) == "GYM_FREE_PUTDOWN"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "GYM_FREE_PUTDOWN" at 7@
            end
        end

        get_script_struct_named 1@ = get_script_struct_named 'GYMTREA' //     
        if and
            is_local_var_bit_set_const 31@ bit Gymtread
            1@ > 0
        then
            //  
            if Actor.Animation($PLAYER_ACTOR) == "GYM_TREAD_GETON"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "GYM_TREAD_GETON" at 8@
            end
            if Actor.Animation($PLAYER_ACTOR) == "GYM_TREAD_GETOFF"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "GYM_TREAD_GETOFF" at 8@
            end
            if Actor.Animation($PLAYER_ACTOR) == "GYM_WALK_FALLOFF"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "GYM_WALK_FALLOFF" at 8@
            end
            if Actor.Animation($PLAYER_ACTOR) == "GYM_JOG_FALLOFF"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "GYM_JOG_FALLOFF" at 8@
            end
            if Actor.Animation($PLAYER_ACTOR) == "GYM_TREAD_FALLOFF"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "GYM_TREAD_FALLOFF" at 8@
            end
            if Actor.Animation($PLAYER_ACTOR) == "GYM_TREAD_CELEBRATE"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "GYM_TREAD_CELEBRATE" at 8@
            end
        end
    
        if
            $ACTIVE_INTERIOR == 0
        then
            continue
        end

    
        // 
        get_script_struct_named 1@ = get_script_struct_named 'JFUD' //                      
        if and
            is_local_var_bit_set_const 31@ bit Food
            1@ > 0
            does_char_exist $FOOD_SELLER 
        then
            if Actor.Animation($FOOD_SELLER) == "SHP_TRAY_LIFT" 
            then set_char_anim_speed $FOOD_SELLER perform_animation "SHP_TRAY_LIFT" at 2@
            end
            if Actor.Animation($FOOD_SELLER) == "SHP_TRAY_RETURN" 
            then set_char_anim_speed $FOOD_SELLER perform_animation "SHP_TRAY_RETURN" at 2@
            end
            if Actor.Animation($FOOD_SELLER) == "SHP_TRAY_LIFT_IN" 
            then set_char_anim_speed $FOOD_SELLER perform_animation "SHP_TRAY_LIFT_IN" at 2@
            end
        end
    
        // 
        get_script_struct_named 1@ = get_script_struct_named 'AMUNAT' //    
        if and
            is_local_var_bit_set_const 31@ bit Ammu
            1@ > 0
            does_char_exist $AMMU_SELLER
        then
            if Actor.Animation($AMMU_SELLER) == "SHP_G_LIFT_IN" 
            then set_char_anim_speed $AMMU_SELLER perform_animation "SHP_G_LIFT_IN" at 3@
            end
            if Actor.Animation($AMMU_SELLER) == v$9554 
            then set_char_anim_speed $AMMU_SELLER perform_animation v$9554 at 3@
            end
            if Actor.Animation($AMMU_SELLER) == v$AMMU_SELLER_ANIMATION 
            then set_char_anim_speed $AMMU_SELLER perform_animation v$AMMU_SELLER_Animation at 3@
            end
            if Actor.Animation($AMMU_SELLER) == "SHP_G_LIFT_OUT" 
            then set_char_anim_speed $AMMU_SELLER perform_animation "SHP_G_LIFT_OUT" at 3@
            end
            if Actor.Animation($AMMU_SELLER) == v$9558 
            then set_char_anim_speed $AMMU_SELLER perform_animation v$9558 at 3@
            end
            if Actor.Animation($AMMU_SELLER) == v$9566 
            then set_char_anim_speed $AMMU_SELLER perform_animation v$9566 at 3@
            end
        end
    
        //  
        get_script_struct_named 1@ = get_script_struct_named 'CLOTH' //     
        if and
            is_local_var_bit_set_const 31@ bit Clothes
            1@ > 0
        then
            //  
            if Actor.Animation($PLAYER_ACTOR) == "CLO_POSE_IN" 
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "CLO_POSE_IN" at 4@
            end
            if Actor.Animation($PLAYER_ACTOR) == "CLO_OUT" 
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "CLO_OUT" at 4@
            end
            if Actor.Animation($PLAYER_ACTOR) == "CLO_POSE_OUT" 
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "CLO_POSE_OUT" at 4@
            end
            if Actor.Animation($PLAYER_ACTOR) == "CLO_POSE_OUT" 
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "CLO_POSE_OUT" at 4@
            end
            if Actor.Animation($PLAYER_ACTOR) == "CLO_IN" 
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "CLO_IN" at 4@
            end
            if Actor.Animation($PLAYER_ACTOR) == v$9994 
            then set_char_anim_speed $PLAYER_ACTOR perform_animation v$9994 at 4@
            end

            //    
            if
                is_local_var_bit_set_const 31@ bit Clothes_skip
            then
                if and
                    $9998 == 2 //    .         
                    not is_button_pressed 0 pressed_key 15 //      2,      main.scm
                then
                    $9998 = 3 //     
                end
            end

            //  
            if
                does_object_exist $9989
            then
                if is_object_playing_anim $9989 animation == "CLO_POSE_IN_O"
                then set_object_anim_speed $9989 animation "CLO_POSE_IN_O" at 4@
                end
                if is_object_playing_anim $9989 animation == "CLO_POSE_OUT_O"
                then set_object_anim_speed $9989 animation "CLO_POSE_OUT_O" at 4@
                end
            end
        end
    
        //     
        get_script_struct_named 1@ = get_script_struct_named 'WARROBE' //     
        if and
            is_local_var_bit_set_const 31@ bit Wardrobe
            1@ > 0
        then
            //  
            if Actor.Animation($PLAYER_ACTOR) == "CLO_POSE_IN" 
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "CLO_POSE_IN" at 5@
            end
            if Actor.Animation($PLAYER_ACTOR) == "CLO_OUT" 
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "CLO_OUT" at 5@
            end
            if Actor.Animation($PLAYER_ACTOR) == "CLO_BUY"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "CLO_BUY" at 5@
            end
            if Actor.Animation($PLAYER_ACTOR) == "CLO_POSE_OUT" 
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "CLO_POSE_OUT" at 5@
            end
            if Actor.Animation($PLAYER_ACTOR) == "CLO_IN" 
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "CLO_IN" at 5@
            end
            if Actor.Animation($PLAYER_ACTOR) == v$9864
            then set_char_anim_speed $PLAYER_ACTOR perform_animation v$9864 at 5@
            end
         end
            //  
            if
                does_object_exist $9811
            then
                if is_object_playing_anim $9811 animation == "CLO_POSE_IN_O"
                then set_object_anim_speed $9811 animation "CLO_POSE_IN_O" at 5@
                end
                if is_object_playing_anim $9811 animation == "CLO_POSE_OUT_O"
                then set_object_anim_speed $9811 animation "CLO_POSE_OUT_O" at 5@
                end
            end


        get_script_struct_named 1@ = get_script_struct_named 'RBRD' //              
        if and
            is_local_var_bit_set_const 31@ bit Donut
            1@ > 0
            does_char_exist $FOOD_SELLER 
        then
            if Actor.Animation($FOOD_SELLER) == "SHP_TRAY_LIFT" 
            then set_char_anim_speed $FOOD_SELLER perform_animation "SHP_TRAY_LIFT" at 9@
            end
            if Actor.Animation($FOOD_SELLER) == "SHP_TRAY_RETURN" 
            then set_char_anim_speed $FOOD_SELLER perform_animation "SHP_TRAY_RETURN" at 9@
            end
            if Actor.Animation($FOOD_SELLER) == "SHP_TRAY_LIFT_IN" 
            then set_char_anim_speed $FOOD_SELLER perform_animation "SHP_TRAY_LIFT_IN" at 9@
            end
        end
        
        get_script_struct_named 1@ = get_script_struct_named 'BARB' //      
        if and
            is_local_var_bit_set_const 31@ bit barber
            1@ > 0
            does_char_exist $9731
        then
            if Actor.Animation($9731) == "BRB_Out"
            then set_char_anim_speed $9731 perform_animation "BRB_Out" at 10@
            end
            if Actor.Animation($9731) == "BRB_In"
            then set_char_anim_speed $9731 perform_animation "BRB_In" at 10@
            end
            if Actor.Animation($9731) == "BRB_Cut_In"
            then set_char_anim_speed $9731 perform_animation "BRB_Cut_In" at 10@
            end
            if Actor.Animation($9731) == "BRB_Cut_Out"
            then set_char_anim_speed $9731 perform_animation "BRB_Cut_Out" at 10@
            end
            if Actor.Animation($9731) == "BRB_Buy"
            then set_char_anim_speed $9731 perform_animation "BRB_Buy" at 10@
            end

            if Actor.Animation($PLAYER_ACTOR) == "BRB_Sit_In"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "BRB_Sit_In" at 10@
            end
            if Actor.Animation($PLAYER_ACTOR) == "BRB_Sit_Out"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "BRB_Sit_Out" at 10@
            end
            if Actor.Animation($PLAYER_ACTOR) == "BRB_Hair_01"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "BRB_Hair_01" at 10@
            end
            if Actor.Animation($PLAYER_ACTOR) == "BRB_Hair_02"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "BRB_Hair_02" at 10@
            end
            if Actor.Animation($PLAYER_ACTOR) == "BRB_Beard_01"
            then set_char_anim_speed $PLAYER_ACTOR perform_animation "BRB_Beard_01" at 10@
            end
        end
    end
end